import { configureStore,combineReducers } from "@reduxjs/toolkit";
import { persistStore,persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
import counterReducer from "./modules/counter";
import userReducer from "./modules/user";
const rootStore=combineReducers({
    counterReducer,
    userReducer
})
const persistConfig={
    key:'root',
    storage:storage
}
const persistedReducer=persistReducer(persistConfig,rootStore)

const store=configureStore({
    reducer:persistedReducer,
    middleware:(getDefaultMiddleware)=>getDefaultMiddleware({
        serializableCheck:false
    })
})
const persistor = persistStore(store)

export {store,persistor}